import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Manage from '@/views/Manage/index.vue'
import Daily from '@/views/Manage/Daily/index.vue'
import Message from '@/views/Manage/Message/index.vue'
import Login from '@/views/Login/index.vue'

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect: '/manage/daily/customerManage'
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/manage',
    component: Manage,
    children: [
      {
        path: 'daily',
        name: 'daily',
        component: Daily,
        children: [
          {
            path: 'customerManage',
            name: 'customerManage',
            component: () => import('@/views/Manage/Daily/CustomerManage.vue')
          },
          {
            path: 'milkmanManage',
            name: 'milkmanManage',
            component: () => import('@/views/Manage/Daily/MilkmanManage.vue')
          },
          {
            path: 'dailyPlan',
            name: 'dailyPlan',
            component: () => import('@/views/Manage/Daily/DailyPlan.vue')
          }
        ]
      },
      {
        path: 'message',
        name: 'message',
        component: Message,
        children: [
          {
            path: 'customerMessage',
            name: 'customerMessage',
            component: () => import('@/views/Manage/Message/Customer/index.vue')
          },
          {
            path: 'productMessage',
            name: 'productMessage',
            component: () => import('@/views/Manage/Message/Product/index.vue')
          },
          {
            path: 'milkmanMessage',
            name: 'milkmanMessage',
            component: () => import('@/views/Manage/Message/Milkman/index.vue')
          },
          {
            path: 'statement',
            name: 'statement',
            component: () => import('@/views/Manage/Message/Statement/index.vue')
          }
        ]
      }
    ]
  },
  {
    path: '/user',
    name: 'user',
    component: () => import('@/views/UserInfo/index.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})

export default router
